#include <iostream>
#include "Account.h"

using namespace std;

Account::Account(double money) {
	if (money < 0) {
		money = 0;
		cout << endl << "Invalid initial balance, balance was set to 0" << endl;
	}
	Balance = money;
}

double Account::getBalance() {
	return Balance;
}

void Account::credit(double money) {
	if (money < 0) {
		cout << endl << "Invalid amount" << endl;
		return;
	}

	Balance += money;
}

void Account::debit(double money) {
	if (money < 0) {
		cout << endl << "Invalid amount" << endl;
		return;
	} else if (money > Balance) {
		cout << endl << "Debit amount exceeded account balance." << endl;
		return;
	}

	Balance -= money;
}

Account::operator double(){
	return Balance;
}



